import gql from "graphql-tag";
export const typeDefs = gql`
  type Query {
    childItemById(id: ID!): ChildItem!
    childItems: [ChildItem]!
    commonItemById(id: ID!): CommonItem!
    commonItems: [CommonItem]!
    projectById(id: ID!): Project!
    projects: [Project]!
    workspaceById(id: ID!): Workspace!
    workspaces: [Workspace]!
  }
  type Mutation {
    addChildItem(parent: ID!, title: String): ChildItemUpdateResponse
    addCommonItem(
      parent: ID!
      title: String
      index: Int
    ): CommonItemUpdateResponse
    addProject(title: String, parent: ID): ProjectUpdateResponse
    addWorkspace(title: String): WorkspaceUpdateResponse
    updateCommonItem(item: CommonItemUpdate!): CommonItemUpdateResponse
    updateCommonItems(items: [CommonItemUpdate]!): CommonItemsUpdateResponse
    removeChildItemById(id: ID!): ChildItemUpdateResponse
    removeChildItemByIds(ids: [ID]!): ChildItemsUpdateResponse
    removeCommonItemById(id: ID!): CommonItemUpdateResponse
    removeCommonItemByIds(ids: [ID]!): CommonItemsUpdateResponse
    removeProjectById(id: ID!): ProjectUpdateResponse
    removeProjectByIds(ids: [ID]!): ProjectsUpdateResponse
    removeWorkspaceById(id: ID!): WorkspaceUpdateResponse
    removeWorkspaceByIds(ids: [ID]!): WorkspacesUpdateResponse
  }
  type ChildItem {
    id: ID!
    itemType: String!
    title: String!
    parent: String!
    done: Boolean!
  }
  type ChildItemUpdateResponse {
    success: Boolean!
    message: String
    childItem: ChildItem
  }
  type ChildItemsUpdateResponse {
    success: Boolean!
    message: String
    childItems: [ChildItem]
  }
  input CommonItemUpdate {
    id: ID!
    title: String
    note: String
    parent: String
    done: Boolean
    index: Int
  }
  type CommonItem {
    id: ID!
    itemType: String!
    title: String!
    note: String!
    childItemIds: [String]!
    parent: String!
    done: Boolean!
    index: Int!
  }
  type CommonItemUpdateResponse {
    success: Boolean!
    message: String
    commonItem: CommonItem
    commonItems: [CommonItem]
    projects: [Project]
  }
  type CommonItemsUpdateResponse {
    success: Boolean!
    message: String
    commonItems: [CommonItem]
    projects: [Project]
  }
  type Project {
    id: ID!
    itemType: String!
    title: String!
    note: String!
    commonItemIds: [String]!
    parent: String!
  }
  type ProjectUpdateResponse {
    success: Boolean!
    message: String
    project: Project
  }
  type ProjectsUpdateResponse {
    success: Boolean!
    message: String
    projects: [Project]
  }
  type Workspace {
    id: ID!
    itemType: String!
    title: String!
    projectIds: [String]!
    parent: String!
  }
  type WorkspaceUpdateResponse {
    success: Boolean!
    message: String
    workspace: Workspace
  }
  type WorkspacesUpdateResponse {
    success: Boolean!
    message: String
    workspaces: [Workspace]
  }
`;
